package com.chexiehui.jc.utils;

import android.os.Bundle;
import android.os.Parcelable;

import java.io.Serializable;
import java.util.List;

/**
 * Created by SongJun on 2017-12-04.
 */

public class BundleBuilder {
    private Bundle bundle;

    public BundleBuilder(){
        bundle = new Bundle();
    }

    public BundleBuilder putInt(String key, int value){
        bundle.putInt(key,value);
        return this;
    }

    public BundleBuilder putString(String key, String value){
        bundle.putString(key,value);
        return this;
    }

    public BundleBuilder putBoolean(String key, boolean value){
        bundle.putBoolean(key,value);
        return this;
    }

    public BundleBuilder putDouble(String key, double value){
        bundle.putDouble(key,value);
        return this;
    }

    public BundleBuilder putFloat(String key, float value){
        bundle.putFloat(key,value);
        return this;
    }

    public BundleBuilder putLong(String key, long value){
        bundle.putLong(key,value);
        return this;
    }
    public BundleBuilder putSerializableList(String key, List<? extends Serializable> value){
        bundle.putSerializable(key, (Serializable) value);
        return this;
    }

    public BundleBuilder putSerializable(String key, Serializable value){
        bundle.putSerializable(key, value);
        return this;
    }
    public BundleBuilder putParcelable(String key, Parcelable value){
        bundle.putParcelable(key, value);
        return this;
    }

    public Bundle create(){
        return bundle;
    }
}
